Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. RegExp.prototype.test() · Character classes · Assertions · Quantifiers
3 天前 · Description. Use test() whenever you want to know whether a pattern is found in a string. test() returns a boolean, unlike the String.prototype. Try it · Syntax · Description · Examples
If the regex has the global flag set, test() will advance the lastIndex of the regex. A subsequent use of test() will start the search at the substring of str ...